package leetcode;

import java.util.Arrays;

public class Q2575 {
    public int[] divisibilityArray(String word, int m) {

        int[] res = new int[word.length()];
        long mod = 0;
        mod = ((int) word.charAt(0) - 48) % m;
        System.out.println(mod);

        if (mod == 0) {
            res[0] = 1;
        } else {
            res[0] = 0;
        }

        if (word.length() == 1) {
            return res;
        }

        for (int i = 1; i < res.length; i++) {
            mod = (10 * mod + (int) word.charAt(i) - 48) % m;
            if (mod == 0) {
                res[i] = 1;
            } else {
                res[i] = 0;
            }
        }

        return res;
    }

    public static void main(String[] args) {
        Q2575 sl = new Q2575();
        String word = "998244353";
        int m = 3;
        System.out.println(Arrays.toString(sl.divisibilityArray(word, m)));
    }
}